﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Registration
{
    public partial class RegistrationForm : System.Web.UI.Page
    {
        protected void btnShowHtmlEncoded_Click(object sender, EventArgs e)
        {
            string enteredText;
            enteredText = "<h3>First Name:" + Server.HtmlEncode(firstName.Text) + "</h3>";
            enteredText = enteredText + "<h3>Last Name:" + Server.HtmlEncode(lastName.Text) + "</h3>";
            enteredText = enteredText + "<h3>Faculty Number:" + Server.HtmlEncode(facultyNumber.Text) + "</h3>";
            enteredText = enteredText + "<h3>University:" + university.SelectedValue + "</h3>";
            enteredText = enteredText + "<h3>Speciality:" + speciality.SelectedValue + "</h3>";
            enteredText = enteredText + "<h3>Courses:";
            for (int i = 0; i < courses.Items.Count; i++)
            {
                if (courses.Items[i].Selected == true)
                {
                    enteredText = enteredText + "<p>" + courses.Items[i].Text + "</p>";
                }
            }
            enteredText = enteredText + "</h3>";
            result.Text = enteredText;
        }
    }
}